var costFirstPageChart;
var monthList = ["3月","4月","5月","6月","7月","8月"];
var totalPriceData = [16011.24,18976.43,17513.62,17916.77,20011.34,19874.66];

$(document).ready(function() {
    showLoading();
    $('title', parent.document).html($('title').text());
    setBaseUrl();
    costFirstPageChart();
    changeEchart();
    setTimeout(hideLoading, 700);
});

function addRemoveClass(allClass, singleClass, singleId, method){
	$("." + allClass).removeClass(singleClass);
	$("#" + singleId).addClass(singleClass);
	if (typeof method === 'function') {
		method(singleId);
	}
}
function costFirstPageChart(){
	costFirstPageChart = echarts.init(document.getElementById("firstEcharts"));
	costFirstPageChart.setOption(searchEcharts("vertical", "right", "center", 0, "统计信息", [{value: 0, name: "0", "itemStyle": echartStyle('#EAEAEA', false, false, '#EAEAEA')}]
	,['35%', '50%'],'60个','总站数','', '#CCC', '', 'black', '30', 'center', 120));
	search();
}
function search(){
	var operation = 10; //已审核
	var construction = 20; //待审核
	var developed = 30; //未审核
	var countData = [];
	countData.push({"value":operation, 
		"name":'已审核:' + operation, 
		"itemStyle": echartStyle('#1abc9c', false, false,'#1abc9c', -3)
		});
	countData.push({"value":construction, 
		"name":'待审核:' + construction, 
		"itemStyle": echartStyle('#e4ae1e', false, false,'#e4ae1e', -3)
		});
	countData.push({"value":developed, 
		"name":'未审核:' + developed, 
		"itemStyle": echartStyle('#929292', false, false,'#929292', -3)
		});
	option.series[0].data = countData;
	option.legend.data = ['已审核:' + operation,'待审核:' + construction,'未审核:' + developed];
	costFirstPageChart.setOption(option, true);
}
function changeEchart(){
	$("#detailOneBody").empty();
	myChart = echarts.init(document.getElementById('detailOneBody'));
    var option = {
            tooltip: {
                trigger: 'axis'
            },
            xAxis: [
                {
                    type: 'category',
                    name: '月份',
                    data: monthList
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: '总费用',
                    min: 0,
                    axisLabel: {
                        formatter: '{value} '
                    }
                }
            ],
            series: [
                {
                    name:'费用',
                    type:'line',
                    itemStyle: {
                        normal : {
                            color: '#09be09',
                        }
                    },
                    data:totalPriceData
                }
            ]
        };
    myChart.setOption(option);
}